<template>
	<gui-page>
		<!-- 页面主体 -->
		<template v-slot:gBody>
			<view>
				<form @submit="submit">

					<view class="gui-bg-white gui-dark-bg-level-3 gui-padding-x">

						<view style="padding:15rpx 0;">
							<textarea v-model="formData.message" placeholder="意见反馈..."
								class="gui-textarea gui-bg-gray gui-dark-bg-level-1 gui-padding"
								style="width:690rpx;"></textarea>
						</view>

					</view>
					<view class="gui-margin-top gui-flex gui-row gui-nowrap gui-justify-content-end gui-padding-x">
						<button type="default" class="gui-button gui-bg-primary gui-noborder" style="width:100%;"
							formType="submit">
							<text class="gui-icons gui-color-white gui-button-text">提交</text>
						</button>
					</view>
					<view style="height:60rpx;"></view>
				</form>
			</view>
		</template>
	</gui-page>
</template>
<script>
	export default {
		data() {
			return {
				// 表单数据存储
				formData: {
					user_id:'',
					message: '',
				},
			}
		},
		onLoad(e) {
			var user = uni.gRequest.checkLogin();

			if (user) {
				this.formData.userId = user.userId
			}

		},

		methods: {
			// 表单提交
			submit: function(e) {
				if (!this.formData.message) {
					uni.showToast({
						title: "请输入意见反馈"
					});
					return;
				}
				
				uni.gRequest.post("feedback",JSON.stringify(this.formData)).then(x=>{
					uni.showToast({
						title: "提交成功"
					});

					uni.navigateBack();
				});
			},
			
		}
	}
</script>
<style scoped>
	.gui-idcard-main {
		margin: 25rpx;
	}

	.gui-idcard-desc {
		line-height: 56rpx;
		font-size: 26rpx;
		padding: 20rpx;
		border-radius: 10rpx;
	}

	.gui-idcard-text {
		line-height: 1.8em;
		margin-top: 30rpx;
	}

	.gui-idcard-items {
		padding: 50rpx;
		border-radius: 10rpx;
		margin-top: 15rpx;
	}

	.gui-idcard-items-image {
		width: 380rpx;
	}
</style>